package com.tarena.test;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class NullLayoutDemo {
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		JPanel panel = new JPanel();
		JButton ok = new JButton("ok");
		JButton cancel = new JButton("cancel");
		panel.setLayout(null);  //取消原有布局
		frame.setSize(435,365);
		ok.setLocation(228,301);
		ok.setSize(90,20);
		cancel.setLocation(326,301);
		cancel.setSize(90,20);
		panel.add(ok);
		panel.add(cancel);
		frame.add(panel);
		frame.setVisible(true);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}
